miscellaneous cleanups (#496)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Thu, 6 Feb 2020 01:45:52 +0000 (18:45 -0700)
committerGitHub <noreply@github.com>
Thu, 6 Feb 2020 01:45:52 +0000 (18:45 -0700)
* msvc, resharper fixes

Some "Qualifier is redundant"
"Redundant empty declaration"
"Redundant empty statement"

* restore missing comment

* various corrections ...

clazy clang-range-loop
some casting that confuse clang-tidy google-readability-casting

.gitignore
cst.cc
defs.h
filter_vecs.h
garmin_fit.cc
igo8.cc
mmo.cc
nmea.cc
sort.cc

index 1ef1a9845108938a3d0671d6ccd221ce26f250b1..b75414fefa7d15182f175b0742c20765efc72ce3 100644 (file)
@@ -5,6 +5,7 @@
 /config.log
 /config.status
 /cscope.out
+/debug/
 /gpsbabel
 /gpsbabel-debug
 /gpsbabel_coverage.xml
@@ -25,6 +26,7 @@
 /Makefile
 /makelinuxdist.sh
 /objects/
+/release/
 *.swp
 /tmp/
 /Makefile
diff --git a/cst.cc b/cst.cc
index 887465bba37179df13e71585a889d5565794167f..57079349c146d53b349ff7c18e219cb0bb1658d3 100644 (file)
--- a/cst.cc
+++ b/cst.cc
@@ -270,7 +270,7 @@ cst_data_read()
           track = route_head_alloc();
           track_add_head(track);
         } else if (strncmp(name, "NAME:", 5) == 0) {
-          wpt->shortname = QString::fromLatin1(((char*)&name) + 5);
+          wpt->shortname = QString::fromLatin1(name + 5);
         }
 
         QString time_string(cin);
diff --git a/defs.h b/defs.h
index b1e456f8e8f43ad89f5b37aaf200bdeb7fbb4b23..ed732d20214cdf4ba58b1e6901d254a2f6bb1289 100644 (file)
--- a/defs.h
+++ b/defs.h
 #  define M_PI 3.14159265358979323846
 #endif
 
-constexpr double FEET_TO_METERS(double feetsies) { return (feetsies) * 0.3048; };
-constexpr double METERS_TO_FEET(double meetsies) { return (meetsies) * 3.2808399; };
+constexpr double FEET_TO_METERS(double feetsies) { return (feetsies) * 0.3048; }
+constexpr double METERS_TO_FEET(double meetsies) { return (meetsies) * 3.2808399; }
 
-constexpr double NMILES_TO_METERS(double a) { return a * 1852.0;};     /* nautical miles */
-constexpr double METERS_TO_NMILES(double a) { return a / 1852.0;};
+constexpr double NMILES_TO_METERS(double a) { return a * 1852.0;}      /* nautical miles */
+constexpr double METERS_TO_NMILES(double a) { return a / 1852.0;}
 
-constexpr double MILES_TO_METERS(double a) { return (a) * 1609.344;};
-constexpr double METERS_TO_MILES(double a) { return (a) / 1609.344;};
-constexpr double FATHOMS_TO_METERS(double a) { return (a) * 1.8288;};
+constexpr double MILES_TO_METERS(double a) { return (a) * 1609.344;}
+constexpr double METERS_TO_MILES(double a) { return (a) / 1609.344;}
+constexpr double FATHOMS_TO_METERS(double a) { return (a) * 1.8288;}
 
-constexpr double CELSIUS_TO_FAHRENHEIT(double a) { return (((a) * 1.8) + 32);};
-constexpr double FAHRENHEIT_TO_CELSIUS(double a) { return (((a) - 32) / 1.8);};
+constexpr double CELSIUS_TO_FAHRENHEIT(double a) { return (((a) * 1.8) + 32);}
+constexpr double FAHRENHEIT_TO_CELSIUS(double a) { return (((a) - 32) / 1.8);}
 
 constexpr long SECONDS_PER_HOUR = 60L * 60;
 constexpr long SECONDS_PER_DAY = 24L * 60 * 60;
 
 /* meters/second to kilometers/hour */
-constexpr double MPS_TO_KPH(double a) { return (a)*SECONDS_PER_HOUR/1000.0;};
+constexpr double MPS_TO_KPH(double a) { return (a)*SECONDS_PER_HOUR/1000.0;}
 
 /* meters/second to miles/hour */
-constexpr double MPS_TO_MPH(double a) { return METERS_TO_MILES(a) * SECONDS_PER_HOUR;};
+constexpr double MPS_TO_MPH(double a) { return METERS_TO_MILES(a) * SECONDS_PER_HOUR;}
 
 /* meters/second to knots */
-constexpr double MPS_TO_KNOTS(double a) { return MPS_TO_KPH((a)/1.852);};
+constexpr double MPS_TO_KNOTS(double a) { return MPS_TO_KPH((a)/1.852);}
 
 /* kilometers/hour to meters/second */
-constexpr double KPH_TO_MPS(double a) { return a * 1000.0/SECONDS_PER_HOUR;};
+constexpr double KPH_TO_MPS(double a) { return a * 1000.0/SECONDS_PER_HOUR;}
 
 /* miles/hour to meters/second */
 #define MPH_TO_MPS(a) (MILES_TO_METERS(a) / SECONDS_PER_HOUR)
 
 /* knots to meters/second */
-constexpr double KNOTS_TO_MPS(double a)  {return KPH_TO_MPS(a) * 1.852; };
+constexpr double KNOTS_TO_MPS(double a)  {return KPH_TO_MPS(a) * 1.852; }
 
 #define MILLI_TO_MICRO(t) ((t) * 1000)  /* Milliseconds to Microseconds */
 #define MICRO_TO_MILLI(t) ((t) / 1000)  /* Microseconds to Milliseconds*/
index 43fb1b6e6483fec7476cb0d0468bc2d84b71c2ca..b3489a7bcf57337eca756d0169f5153df51f0cc1 100644 (file)
@@ -82,9 +82,9 @@ void disp_filters(int version) const;
 bool validate_filters() const;
 
 private:
-static void disp_help_url(const FilterVecs::fl_vecs_t& vec, const arglist_t* arg);
-static void disp_v1(const FilterVecs::fl_vecs_t& vec);
-static bool validate_filter_vec(const FilterVecs::fl_vecs_t& vec);
+static void disp_help_url(const fl_vecs_t& vec, const arglist_t* arg);
+static void disp_v1(const fl_vecs_t& vec);
+static bool validate_filter_vec(const fl_vecs_t& vec);
 
 private:
   ArcDistanceFilter arcdist;
index ca55c6ffb149f1e298af96cc8c9999b135de021a..f43c750f7c0869f22c1924043c6eca520a7adaff 100644 (file)
@@ -1263,7 +1263,7 @@ fit_collect_track_tlr(const route_head *rte)
     double best_odometer_distance = 0;
     for (auto cit = course.begin(); cit != course.end(); cit++) {
       if (!cit->is_course_point) {
-        double distance = gcgeodist(cit->lat, cit->lon, wpt.lat, wpt.lon);;
+        double distance = gcgeodist(cit->lat, cit->lon, wpt.lat, wpt.lon);
         if (best_distance < 0 || distance < best_distance) {
           best_distance = distance;
           best_distance_it = cit;
diff --git a/igo8.cc b/igo8.cc
index 4ba0f741c02048fca2dcdd1abb986e6c7fdabbc9..9dbabccd9d818274bf9f247b12a3a17ffb24e453 100644 (file)
--- a/igo8.cc
+++ b/igo8.cc
@@ -258,7 +258,7 @@ static unsigned int print_unicode(char* dst, int dst_max_length, const QString&
   if (max_qchars < 1) {
     // We must have room for the terminator.
     fatal(MYNAME ": igo8 header overflow.\n");
-  };
+  }
   // Write as many characters from the source as possible
   // while leaving space for a terminator.
   int n_src_qchars = std::min(max_qchars - 1, src.size());
diff --git a/mmo.cc b/mmo.cc
index 329e047cb338f88c43380ff3c13b3689d5d2a7bd..080d12c44ce61466a4305dd52c494df6952120f4 100644 (file)
--- a/mmo.cc
+++ b/mmo.cc
@@ -1047,7 +1047,7 @@ mmo_writestr(const QString& str)
   bool topbitset = false;
 
   // see if there's any utf-8 multi-byte chars
-  QByteArray utf8 = str.toUtf8();
+  const QByteArray utf8 = str.toUtf8();
   int len = utf8.size();
   for (unsigned char byte : utf8) {
     if (byte & 0x80) {
diff --git a/nmea.cc b/nmea.cc
index 4b217ee9562c7439621f4caed6ee0ceea05d90c2..167b0767ff4329b3b7c546eb214bbecafca2f265 100644 (file)
--- a/nmea.cc
+++ b/nmea.cc
@@ -814,7 +814,7 @@ pcmpt_parse(char* ibuf)
   dmy = hms = 0;
 
   sscanf(ibuf,"$PCMPT,%d,%d,%d,%c,%f,%d,%19[^,],%d,%f,%d,%f,%c,%d,%c,%d",
-         &j1, &j2, &j3, &altflag, &alt, &j4, (char*) &coords,
+         &j1, &j2, &j3, &altflag, &alt, &j4, coords,
          &j5, &f1, &j6, &f2, &u1, &dmy, &u2, &hms);
 
   if (altflag == 'D' && curr_waypt && alt > 0) {
diff --git a/sort.cc b/sort.cc
index 7f3f3df20f9d4caaf89b72b269aafb388917ad6f..417520f175f0a77273ba28514ff9a4e17d0bdb45 100644 (file)
--- a/sort.cc
+++ b/sort.cc
@@ -89,7 +89,7 @@ void SortFilter::process()
   if (rte_sort_mode != SortModeRteHd::none) {
     switch (rte_sort_mode)  {
     case SortModeRteHd::description:
-      route_sort(SortFilter::sort_comp_rh_by_description);
+      route_sort(sort_comp_rh_by_description);
       break;
     case SortModeRteHd::name:
       route_sort(sort_comp_rh_by_name);